<?php
/**
 * Created by PhpStorm.
 * User: gc
 * Date: 2018/1/11
 * Time: 7:07
 */

namespace Adapter\MediaPlayer;


use Adapter\AdvancedMediaPlayer\Mp4Player;
use Adapter\AdvancedMediaPlayer\VlcPlayer;

class MediaAdapter implements MediaPlayer
{
    private $advancedMediaPlayer = null;

    function __construct($audioType)
    {
        if ( 'vlc'== $audioType) {
            $this->advancedMediaPlayer = new VlcPlayer();
        } else if ('mp4' == $audioType) {
            $this->advancedMediaPlayer = new Mp4Player();
        }
    }

    function play($audioType, $fileName)
    {
        if('vlc' == $audioType) {
            $this->advancedMediaPlayer->playVlc();
        } else if ('mp4' == $audioType) {
            $this->advancedMediaPlayer->playMp4();
        }
    }

}
